<template>
	<view class="wallet_box">
		<view class="wallet_box_top">
			<view class="wallet_box_top_word">
				<text class="wallet_box_top_word_account">账户余额（元）</text>
				<view class="wallet_box_top_word_deal" @click="dealRecordClick">
					<text class="wallet_box_top_word_deal_title">交易明细</text>
					<image class="wallet_box_top_word_deal_image" src="/static/my/particulars.png" mode=""></image>
				</view>
			</view>
			<view class="wallet_box_top_money">
				{{options && options.balance}}
			</view>
		</view>
		<view class="wallet_box_bottom">
			<view class=""  v-for="(item,index) in list" :key="index">
				<view v-if="item.isExist" class="wallet_box_bottom_list" :class="[index==(list.length-1)&&'wallet_box_bottom_wire']" @click="listClick(item)">
					<text>
						{{item.title}}
					</text>
					<image src="/static/my/right.png" mode=""></image>
				</view>				
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		
		data() {
			return {
				money:0,
				options:null,
				list:[
					// {
					// 	title:'充值中心',
					// 	id:1,
					// 	isExist:true
					// },
					{
						title:'我的抵扣券',
						id:2,
						isExist:true
					},
					// {
					// 	title:'购买抵扣券',
					// 	id:3,
					// 	isExist:true
					// },
					// {
					// 	title:'抵扣券购买记录',
					// 	id:4,
					// 	isExist:true
					// },
					{
						title:'核销券',
						id:5,
						isExist:true
					},
					{
						title:'券包购买记录',
						id:6,
						isExist:true
					},
				]
			}
		},
		onLoad(options){
			console.log(options,'options')
			this.options = options;
			
		},
		onPullDownRefresh() {
			let _this=this
			setTimeout(function () {
				_this.init()
				uni.stopPullDownRefresh();
			}, 400);
		},
		methods: {
			init(){
				// this.getInfo()
				this.getActive()
			},
			
			getActive(){
				// 	1：平台赠送2：用户购买3：充值赠送
				this.api.couponActiving()
				.then(res=>{
					if(res.active[3]==0){
						this.list[0].isExist=false
					}
					if(res.active[2]==0){
						this.list[2].isExist=false
					}
				})
			},
			getInfo(){
				this.api.couponMyMoney()
				.then(res=>{
					this.money=res.money
				})
			},
			listClick(item){
				if(item.id==1){
					uni.navigateTo({
						url:'/userpage/userinfo/walletDetail/voucherCenter'
					})
					return
				}
				if(item.id==2){
					uni.navigateTo({
						url:'/userpage/userinfo/walletDetail/voucher'
					})
					return
				}
				if(item.id==3){
					uni.navigateTo({
						url:'/userpage/userinfo/walletDetail/buyVoucher'
					})
					return
				}
				if(item.id==4){
					uni.navigateTo({
						url:'/userpage/userinfo/walletDetail/voucherBuyRecord'
					})
					return
				}
				if(item.id==5){ 
					uni.navigateTo({
						url:'/userpage/userinfo/walletDetail/writeOffVoucher'
					})
					return
				}
				if(item.id==6){
					uni.navigateTo({
						url:'/userpage/userinfo/walletDetail/couponPackage'
					})
					return
				}
			},
			dealRecordClick(item){
				
				uni.navigateTo({
					url:'/userpage/userinfo/walletDetail/transactionDetail'
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.wallet_box{
		.wallet_box_top{
			margin:46rpx 30rpx;
			height: 208rpx;
			background: #FFCC00;
			border-radius: 8rpx;
			box-sizing: border-box;
			padding: 40rpx 32rpx 28rpx;
			&_word{
				font-size: 32rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #333333;
				line-height: 44rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				&_account{
					font-size: 32rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #333333;
					line-height: 44rpx;
				}
				&_deal{
					display:flex;
					align-items: center;
					&_title{
						font-size: 24rpx;
						font-family: PingFangSC-Medium, PingFang SC;
						font-weight: 500;
						color: #333333;
						line-height: 34rpx;
					}
					&_image{
						margin-left: 16rpx;
						width: 12rpx;
						height: 20rpx;
						vertical-align: top;
					}
				}
			}
			&_money{
				font-size: 60rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #333333;
				line-height: 84rpx;
				text-align: center;
				margin-top: 12rpx;
			}
		}
		.wallet_box_bottom{
			padding:0 30rpx;
			&_list{
				height: 110rpx;
				box-sizing: border-box;
				display: flex;
				justify-content: space-between;
				align-items: center;
				border-bottom: 2rpx solid #EEEEEE;
				text{
					font-size: 36rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #333333;
					line-height: 50rpx;
				}
				image{
					width: 14rpx;
					height: 20rpx;
				}
			}
			&_wire{
				border-bottom: 0;
			}
		}
	}
</style>
